package cn.iocoder.yudao.module.reading.controller.app.auth.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 绘本阅读 APP - 用户登录 Response VO
 *
 * @author 李晨
 */
@Schema(description = "绘本阅读 APP - 用户登录 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ReadingLoginRespVO {

    @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long userId;

    @Schema(description = "访问令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "happy")
    private String accessToken;

    @Schema(description = "刷新令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "nice")
    private String refreshToken;

    @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime expiresTime;

    @Schema(description = "用户信息")
    private UserInfo userInfo;

    /**
     * 仅微信登录时会返回
     *
     * 为什么需要返回？微信公众号、微信小程序支付需要传递 openid 给支付接口
     */
    @Schema(description = "微信用户 openid", example = "wx_openid_123")
    private String openid;

    @Schema(description = "用户信息")
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class UserInfo {
        @Schema(description = "用户ID", example = "1")
        private Long id;

        @Schema(description = "用户名", example = "testuser")
        private String username;

        @Schema(description = "昵称", example = "测试用户")
        private String nickname;

        @Schema(description = "头像", example = "/static/avatar.png")
        private String avatar;

        // 注释掉手机号字段
        // @Schema(description = "手机号", example = "13800138000")
        // private String phone;

        @Schema(description = "邮箱", example = "test@example.com")
        private String email;
    }

}
